<?php
 session_start();
 include("include/session.php");
 include("include/common.php");
 include("include/db.php");
 
 if(isset($_REQUEST) && $_REQUEST['submit'] != ''){

	$sqlCategory = "UPDATE software_pages
						SET
							page_description	=	'".mysql_real_escape_string($_REQUEST['page_description'])."',
							page_meta_desc		=	'".mysql_real_escape_string($_REQUEST['page_meta_desc'])."',
							page_title			=	'".mysql_real_escape_string($_REQUEST['page_title'])."',
							page_heading		=	'".mysql_real_escape_string($_REQUEST['page_heading'])."'
						WHERE
							page_id = '".intval($_REQUEST['page_id'])."'	
	
				";
	
	if(mysql_query($sqlCategory))
		header("location:pages.php?msg=1&page_id=".intval($_REQUEST['page_id']));
	else
		header("location:pages.php?msg=2&page_id=".intval($_REQUEST['page_id']));
	
	exit();		
 }
 	 $sqlPages = mysql_query("SELECT * FROM software_pages WHERE page_id = '".intval($_REQUEST['page_id'])."'");
	 $resPages = mysql_fetch_array($sqlPages);
 
 ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=TITLE_WEBSITE?></title>
<link href="css/c_energy.css" rel="stylesheet" type="text/css" />
<link href="css/logo.css" rel="stylesheet" type="text/css" />

<!-- TinyMCE -->
<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		height : "280",
		width : "280",


		plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",

	});
</script>
<style type="text/css">
<!--
.style4 {
	font-size: 22px;
	font-weight: bold;
}
.style6 {color: #999999}
-->
</style>
</head>
<body>

    <table width="990" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="3" align="left" valign="top" ><? require("header.php");?></td>
</tr>
  <tr>
    <td align="center" >
	<table width="99%" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="3" align="center" valign="top">&nbsp;</td>
      </tr>
       <tr bgcolor="#FAFAFA">
        <td colspan="0" align="left" valign="top" >
		   <table width="96%" cellspacing="0" cellpadding="0">
		    <tr>
		      <td width="2%" align="left" valign="top" style="padding-left:15px" ><? require("left.php");?></td>
		      <td width="94%"  valign="top" style="padding-left:15px" >
			  <form name="signform" action="" method="post" enctype="multipart/form-data" id="signform" onsubmit="return validation();" >
			    <table id="signInTbl" width="719" cellspacing="0" cellpadding="0" style="border:solid #cccccc 1px">
                  <tr>
                    <td colspan="2" align="left" bgcolor="#000" class="loc_search_found_term"  style="border-bottom:solid #cccccc 1px">Add/ Edit Pages </td>
                  </tr>
                  <?php
                  	if($_REQUEST['msg'] == 1)
					{
				  ?>
                  <tr style="background: #D5FFD5 " height="25">
                 	<td colspan="2"><div align="left" class="successMsg" id="err_site" style="display:block">
                       &nbsp; <strong><?='Pages updated successfully'?></strong>
                    </div></td>
                  </tr>
                  <?php
                  	}?>
				  <tr height="30">
                    <td width="249" align="left" style="padding-left:15px">Page  Name</td>
                    <td width="466" align="left">
                    	<select id="page_name" name="page_name" onchange="location.href='pages.php?page_id='+this.value" style="width:220px" >
                        	<option value="" selected="selected" >Select</option>
 							<?php
                            	$sqlPage = mysql_query("SELECT page_id,page_name FROM software_pages ");
								while($resPage = mysql_fetch_array($sqlPage))
								{
							?>
                            	<option value="<?=$resPage["page_id"]?>" <?=($resPage["page_id"] == $_REQUEST['page_id'] ? 'selected=selected' : '')?> ><?=$resPage["page_name"]?></option>
                            <?php
                            	}
							?>
                        </select>
                    	
                    </td>				  </tr>
                  <tr height="30">
                    <td width="249" height="21" align="left" style="padding-left:15px">Page Title</td>
                    <td width="466" align="left">
                      <input  style="width:220px" name="page_title" id="page_title" type="text" class="Box" value="<?=stripslashes($resPages['page_title'])?>"  maxlength="30" />                    </td>				  </tr>
                  <tr height="30">
                    <td width="249" align="left" style="padding-left:15px">Page Meta Description</td>
                    <td width="466" align="left">
                      <input  style="width:220px" name="page_meta_desc" id="page_meta_desc" type="text" class="Box" value="<?=stripslashes($resPages['page_meta_desc'])?>"   />                    </td>				  </tr>
                  <tr height="30">
                    <td width="249" align="left" style="padding-left:15px">Page Heading</td>
                    <td width="466" align="left">
                      <input  style="width:220px" name="page_heading" id="page_heading" type="text" class="Box" value="<?=stripslashes($resPages['page_heading'])?>"    />                    </td>				  </tr>
                 
                  <tr height="30">
                  <td >&nbsp;</td>
                   <td align="left" >
                   <textarea id="page_description" name="page_description"  ><?=stripslashes($resPages['page_description'])?></textarea>  </td>				  </tr>
                   <tr  height="30">
                    <td width="249"  style="padding-left:15px" colspan="2" align="center"><input class="cls_button" type="submit" id="submit" name="submit" value="Submit"  /></td>
                  </tr>
                   <tr  height="30">
                    <td width="249"  style="padding-left:15px" colspan="2" align="center">                    </td>
                  </tr>
                </table>
			    <ul class="site_nav_menu_buttons">
			      <li class="no_menu_li"></li>
			      </ul>
			    <p>&nbsp;</p>
			  </form>			  </td>
            </tr>
	        </table></td>
        </tr>
      <tr bgcolor="#FAFAFA">
        <td width="800" align="center" valign="top">&nbsp;</td>
        <td width="100" colspan="2">&nbsp;</td>
      </tr>
	    <tr bgcolor="#FAFAFA">
        <td width="800" align="center" valign="top">&nbsp;</td>
        <td colspan="2">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

